﻿@using System.Threading.Tasks
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Models.Languages
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Startup
@using MyCompanyName.AbpZeroTemplate.Web.Startup
@model LanguageTextsViewModel
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Common.Languages;
}

@section Scripts
{
    <script abp-src="/view-resources/Areas/AppAreaName/Views/_Bundles/language-texts.js" asp-append-version="true"></script>
}

<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
    <abp-page-subheader title="@L("LanguageTexts")" description="@L("LanguageTextsHeaderInfo")"></abp-page-subheader>
    
    <div class="@(await GetContainerClass())">
        <div class="card card-custom gutter-b">
                        <div class="card-body">
                            <div class="form" id="TextsFilterForm">
                                <div class="row align-items-center mb-4">
                                    <div class="col-sm-6 col-md-3">
                                        <div class="form-group">
                                            <label for="TextBaseLanguageSelectionCombobox">@L("BaseLanguage")</label>
                                            <select id="TextBaseLanguageSelectionCombobox" name="BaseLanguage"
                                                    class="form-control bs-select"
                                                    data-live-search="true">
                                                @foreach (var language in Model.Languages)
                                                {
                                                    <option data-icon="@language.Icon" value="@language.Name" selected="@(language.Name == Model.BaseLanguageName)">
                                                        <i class="@language.Icon"></i>@language.DisplayName
                                                    </option>
                                                }
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-sm-6 col-md-3">
                                        <div class="form-group">
                                            <label for="TextTargetLanguageSelectionCombobox">@L("TargetLanguage")</label>
                                            <select id="TextTargetLanguageSelectionCombobox" name="TargetLanguage"
                                                    class="form-control bs-select"
                                                    data-live-search="true">
                                                @foreach (var language in Model.Languages)
                                                {
                                                    <option data-icon="@language.Icon" value="@language.Name" selected="@(language.Name == Model.LanguageName)">
                                                        <i class="@language.Icon"></i>@language.DisplayName
                                                    </option>
                                                }
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-sm-6 col-md-3">
                                        <div class="form-group">
                                            <label for="TextSourceSelectionCombobox">@L("Source")</label>
                                            @Html.DropDownList("SourceName", Model.Sources, new {@class = "form-control selectpicker", data_live_search = "true", id = "TextSourceSelectionCombobox"})
                                        </div>
                                    </div>
                                    <div class="col-sm-6 col-md-3">
                                        <div class="form-group">
                                            <label for="TargetValueFilterSelectionCombobox">@L("TargetValue")</label>
                                            <select id="TargetValueFilterSelectionCombobox" class="form-control bs-select" name="TargetValue">
                                                <option value="ALL" selected="@(Model.TargetValueFilter == "ALL")">@L("All")</option>
                                                <option value="EMPTY" selected="@(Model.TargetValueFilter == "EMPTY")">@L("EmptyOnes")</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="row align-items-center mb-4">
                                    <div class="col-sm-12">
                                        <div class="input-group">
                                            <input id="TextFilter" value="@Model.FilterText" class="form-control" placeholder="@L("SearchWithThreeDot")" type="text">
                                            <span class="input-group-btn">
                                                <button id="RefreshTextsButton" class="btn btn-primary" type="submit">
                                                    <i class="icon-refresh"></i> @L("Refresh")
                                                </button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row align-items-center">
                                <table id="TextsTable" class="display table table-separate table-head-custom no-footer dtr-inline dt-responsive nowrap">
                                    <thead>
                                    <tr>
                                        <th></th>
                                        <th>@L("Key")</th>
                                        <th>@L("BaseValue")</th>
                                        <th>@L("TargetValue")</th>
                                        <th></th>
                                    </tr>
                                    </thead>
                                </table>
                            </div>
        
                        </div>
                    </div>
    </div>
</div>
